/*
 *   A task scheduler that implements Monte-Carlo simulation
 *
 *   Copyright (C) 2011 Systasis Computer Systems, Inc.
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *   
 *   $Id: MainPageView.java 68 2011-08-01 22:22:17Z jchimene@gmail.com $
 */
package com.systasis.sked.client.view;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.ViewImpl;
import com.systasis.sked.client.presenter.MainPagePresenter;

public class MainPageView extends ViewImpl implements MainPagePresenter.MyView {

    private static String html = "<h1>Web Application Starter Project</h1>\n" + "<table align=\"center\">\n" + "  <tr>\n" + "    <td colspan=\"2\" style=\"font-weight:bold;\">Please enter your name:</td>\n" + "  </tr>\n" + "  <tr>\n"
	    + "    <td id=\"nameFieldContainer\"></td>\n" + "    <td id=\"sendButtonContainer\"></td>\n" + "  </tr>\n" + "  <tr>\n" + "    <td colspan=\"2\" style=\"color:red;\" id=\"errorLabelContainer\"></td>\n" + "  </tr>\n" + "</table>\n";

    HTMLPanel panel = new HTMLPanel(html);

    @Inject
    public MainPageView() {
	final Button sendButton = new Button("Send");
	final TextBox nameField = new TextBox();
	nameField.setText("GWT User");
	final Label errorLabel = new Label();

	// We can add style names to widgets
	sendButton.addStyleName("sendButton");

	// Add the nameField and sendButton to the RootPanel
	// Use RootPanel.get() to get the entire body element
	panel.add(nameField, "nameFieldContainer");
	panel.add(sendButton, "sendButtonContainer");
	panel.add(errorLabel, "errorLabelContainer");
    }

    @Override
    public Widget asWidget() {
	return panel;
    }
}